<template>
	<view class="container">
		<uni-card>
			<uni-forms-item label="姓名:" label-width="85px"><text>{{name}}</text>
			</uni-forms-item>
			<uni-forms-item label="餐卡卡号:" label-width="85px">
				<text>{{cardNo}}</text>
			</uni-forms-item>
			<uni-forms-item label="手机号:" label-width="85px">
				<text>{{mobile}}</text>
			</uni-forms-item>
			<uni-forms-item label="身份证号:" label-width="85px">
				<text>{{idNo}}</text>
			</uni-forms-item>
			<uni-forms-item label="欠款:" label-width="85px">
				<text>{{owedAmount}}</text>
			</uni-forms-item>
		</uni-card>
	</view>
</template>

<script>
	//个人信息
	export default {
		data() {
			return {
				openid: "",
				name: "-",
				cardNo: "-",
				mobile: "-",
				idNo: "-",
				owedAmount: "0.00"
			}
		},
		onShow() {
			this.getCurrent()
		},
		methods: {
			getCurrent() {
				let that = this;
				uni.getStorage({
					key: 'wx_openid',
					success: function(res) {
						that.openid = res.data;
						uni.request({
							method: 'POST',
							url: that.baseUrl +'/my/getCurrentInfo',
							data: {
								openid: that.openid
							},
							success(ress) {
								if(ress.data.type === 'success'){
									if (ress.data.data.name != null) {
										that.name = ress.data.data.name;
									}
									if (ress.data.data.mobile != null) {
										that.mobile = ress.data.data.mobile;
									}
									
									if (ress.data.data.cardNo != null) {
										that.cardNo = ress.data.data.cardNo;
									}
									if (ress.data.data.idNo != null) {
										that.idNo = ress.data.data.idNo;
									}
									if (ress.data.data.owedAmount != null) {
										that.owedAmount = ress.data.data.owedAmount;
									}
								}
							}
						})
					}
				});
			}
		}
	}
</script>

<style>
	.uni-forms-item__content {
		padding-top: .5rem;

	}
</style>